package com.syl.upimg.service.impl;

import com.syl.upimg.bean.BaseBean;
import com.syl.upimg.service.BaseUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;

/**
 * 苏宁羊毛 没调通
 *
 * @author syl
 * @create 2019-08-02 15:41
 **/
@Service
@Deprecated
public class SuNingFleece implements BaseUpload {

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public RestTemplate createRestTemplate() {
        return restTemplate;
    }

    @Override
    public LinkedMultiValueMap<String, Object> getParam(FileSystemResource file, String fileName, String fileType) {
        LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap();
        linkedMultiValueMap.add("Filedata", file);
        linkedMultiValueMap.add("omsOrderItemId", 1);
        linkedMultiValueMap.add("custNum", 1);
        linkedMultiValueMap.add("deviceType", 1);
        return linkedMultiValueMap;
    }

    public BaseBean upload(String filePath) throws IOException {
        return null;
    }

    @Override
    public HttpHeaders getDefaultHeader() {
        return getDefaultHeader(null, "http://review.suning.com/my_cmmdty_review.do");
    }

    @Override
    public String[] getLimit() {
        return new String[]{"jpg", "png", "bmp", "gif"};
    }

    @Override
    public String getUrl() {
        return "http://review.suning.com/imageload/uploadImg.do";
    }


}
